home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / MPW_TOOL / TOOLS / TOOLS_WI / ICON_8 / H_FOLDER / CONFIG.H next >
Text File  |  1990-03-11  |  11KB  |  530 lines

  1. /*
  2.  * Icon configuration.
  3.  */
  4.  
  5. /*
  6.  * System-specific definitions are in define.h
  7.  */
  8. #include "::h:define.h"
  9.  
  10. #include <stdio.h>
  11.  
  12. /*
  13.  *  A number of symbols are defined here.  Some are specific to individual
  14.  *  to operating systems.  Examples are:
  15.  *
  16.  *    MSDOS        MS-DOS for PCs
  17.  *    UNIX        any UNIX system
  18.  *    VMS        VMS for the VAX
  19.  *
  20.  *  These are defined to be 1 or 0 depending on which operating system
  21.  *  the installation is being done under.  They are all defined and only
  22.  *  one is defined to be 1.  (They are used in the form #if VAX || MSDOS.)
  23.  *
  24.  *  There also are definitions of symbols for specific computers and
  25.  *  versions of operating systems.  These include:
  26.  *
  27.  *    SUN        code specific to the Sun Workstation
  28.  *    MICROSOFT    code specific to the Microsoft C compiler for MS-DOS
  29.  *
  30.  *  Other definitions may occur for different configurations. These include:
  31.  *
  32.  *    DeBug        debugging code
  33.  *    MemMon        memory monitoring output
  34.  *
  35.  *  Other definitions perform configurations that are common to several
  36.  *  systems. An example is:
  37.  *
  38.  *    Double        align reals at double-word boundaries
  39.  *
  40.  */
  41.  
  42. /*
  43.  * The following definitions insure that all the symbols for operating
  44.  * systems that are not relevant are defined to be 0 -- so that they
  45.  * can be used in logical expressions in #if directives.
  46.  */
  47.  
  48. #ifndef PORT
  49. #define PORT 0
  50. #endif                    /* PORT */
  51.  
  52. #ifndef AMIGA
  53. #define AMIGA 0
  54. #endif                    /* AMIGA */
  55.  
  56. #ifndef ATARI_ST
  57. #define ATARI_ST 0
  58. #endif                    /* ATARI_ST */
  59.  
  60. #ifndef HIGHC_386
  61. #define HIGHC_386 0
  62. #endif                    /* HIGHC_386 */
  63.  
  64. #ifndef MACINTOSH
  65. #define MACINTOSH 0
  66. #endif                    /* MACINTOSH */
  67.  
  68. #ifndef MSDOS
  69. #define MSDOS 0
  70. #endif                    /* MSDOS */
  71.  
  72. #ifndef MVS
  73. #define MVS 0
  74. #endif                    /* MVS */
  75.  
  76. #ifndef OS2
  77. #define OS2 0
  78. #endif                    /* OS2 */
  79.  
  80. #ifndef UNIX
  81. #define UNIX 0
  82. #endif                    /* UNIX */
  83.  
  84. #ifndef VM
  85. #define VM 0
  86. #endif                    /* VM */
  87.  
  88. #ifndef VMS
  89. #define VMS 0
  90. #endif                    /* VMS */
  91.  
  92.  
  93. /*
  94.  * The following definitions serve to cast common conditionals is
  95.  *  a positive way, while allowing defaults for the cases that
  96.  *  occur most frequently.  That is, if co-expressions are not supported,
  97.  *  NoCoexpr is defined in define.h, but if they are supported, no
  98.  *  definition is needed in define.h; nonetheless subsequent conditionals
  99.  *  can be cast as #ifdef Coexpr.
  100.  */
  101.  
  102. #ifndef NoCoexpr
  103. #undef Coexpr
  104. #define Coexpr
  105. #endif                    /* NoCoexpr */
  106.  
  107. #ifndef NoEnvVars
  108. #undef EnvVars
  109. #define EnvVars
  110. #endif                    /* NoEnvVars */
  111.  
  112. #ifndef NoTraceBack
  113. #undef TraceBack
  114. #define TraceBack
  115. #endif                    /* NoTraceBack */
  116.  
  117. #ifndef NoStrInvoke
  118. #undef StrInvoke
  119. #define StrInvoke
  120. #endif                    /* NoStrInvoke */
  121.  
  122. #ifndef NoMathFncs
  123. #undef MathFncs
  124. #define MathFncs
  125. #endif                    /* NoMathFncs */
  126.  
  127. #ifndef NoLargeInts
  128. #undef LargeInts
  129. #define LargeInts
  130. #endif                    /* NoLargeInts */
  131.  
  132. #ifndef NoMemMon
  133. #ifdef EnvVars
  134. #undef MemMon
  135. #define MemMon
  136. #endif                    /* EnvVars */
  137. #endif                    /* NoMemMon */
  138.  
  139. #ifndef NoExternalFunctions
  140. #undef ExternalFunctions
  141. #define ExternalFunctions
  142. #endif                    /* NoExternalFunctions */
  143.  
  144. /*
  145.  * EBCDIC == 0 corresponds to ASCII.  EBCDIC == 1 corresponds to EBCDIC
  146.  *  collating sequence, while EBCDIC == 2 provides the ASCII collating
  147.  *  sequence for EBCDIC systems.
  148.  */
  149. #ifndef EBCDIC
  150. #define EBCDIC 0
  151. #endif                    /* EBCDIC */
  152.  
  153. /*
  154.  * Other defaults.
  155.  */
  156.  
  157. #ifdef DeBug
  158. #undef DeBugTrans
  159. #undef DeBugLinker
  160. #undef DeBugIconx
  161. #define DeBugTrans
  162. #define DeBugLinker
  163. #define DeBugIconx
  164. #endif                    /* DeBug */
  165.  
  166. #ifdef ExecImages
  167. #undef IconCalling
  168. #endif                    /* ExecImages */
  169.  
  170. #ifndef AllocType
  171. #define AllocType unsigned int
  172. #endif                    /* AllocType */
  173.  
  174. typedef AllocType msize;
  175.  
  176. #ifndef ErrorExit
  177. #define ErrorExit 1
  178. #endif                    /* ErrorExit */
  179.  
  180. #ifndef NormalExit
  181. #define NormalExit 0
  182. #endif                    /* NormalExit */
  183.  
  184. #ifndef Hz
  185. #define Hz 60
  186. #endif                    /* Hz */
  187.  
  188. #ifndef MaxHdr
  189. #define MaxHdr 4096
  190. #endif                    /* MaxHdr */
  191.  
  192. #ifndef StackAlign
  193. #define StackAlign 2
  194. #endif                    /* StackAlign */
  195.  
  196. #ifndef SysTime
  197. #define SysTime <time.h>
  198. #endif                    /* SysTime */
  199.  
  200. #ifndef WordBits
  201. #define WordBits 32
  202. #endif                    /* WordBits */
  203.  
  204. #ifndef IntBits
  205. #define IntBits WordBits
  206. #endif                    /* IntBits */
  207.  
  208. #ifndef SourceSuffix
  209. #define SourceSuffix ".icn"
  210. #endif                    /* SourceSuffix */
  211.  
  212. #ifndef IcodeSuffix
  213. #define IcodeSuffix ""
  214. #endif                    /* IcodeSuffix */
  215.  
  216. #ifndef IcodeASuffix
  217. #define IcodeASuffix ""
  218. #endif                    /* IcodeASuffix */
  219.  
  220. #ifndef U1Suffix
  221. #define U1Suffix ".u1"
  222. #endif                    /* U1Suffix */
  223.  
  224. #ifndef U2Suffix
  225. #define U2Suffix ".u2"
  226. #endif                    /* U2Suffix */
  227.  
  228. #ifndef USuffix
  229. #define USuffix ".u"
  230. #endif                    /* USuffix */
  231.  
  232. /*
  233.  * Representations of directories. LocalDir is the "current working directory".
  234.  *  SourceDir is where the source file is. 
  235.  */
  236.  
  237. #define LocalDir ""
  238. #define SourceDir (char *)NULL
  239.  
  240. #ifndef TargetDir
  241. #define TargetDir LocalDir
  242. #endif                    /* TargetDir */
  243.  
  244. #ifndef Options
  245. #if UNIX
  246. #define Options "ce:mo:stuxLS:"
  247. #else                    /* UNIX */
  248. #define Options "ce:o:stuxLS:"
  249. #endif                    /* UNIX */
  250. #endif                    /* Options */
  251.  
  252. #ifndef Usage
  253. #if UNIX
  254. #define Usage "[-cmstu] [-e efile] [-o ofile] [-Sxnnnn]"
  255. #else                    /* UNIX */
  256. #define Usage "[-cstu] [-e efile] [-o ofile] [-Sxnnnn]"
  257. #endif                    /* UNIX */
  258. #endif                    /* Usage */
  259.  
  260. #ifndef Pipes
  261. #if UNIX || VMS
  262. #define Pipes
  263. #endif                    /* UNIX || VMS */
  264. #endif                    /* Pipes */
  265.  
  266. #ifndef SystemFnc
  267. #if AMIGA || ATARI_ST || MSDOS || MVS || UNIX || VM || VMS
  268. #define SystemFnc
  269. #endif                    /* AMIGA || ATARI_ST || ... */
  270. #endif                    /* SystemFnc */
  271.  
  272. /*
  273.  * Default sizing and such.
  274.  */
  275.  
  276. /*
  277.  * Set up typedefs and related definitions depending on whether or not
  278.  * ints and pointers are the same size.
  279.  */
  280.  
  281. #if IntBits == 16
  282. typedef long int word;
  283. typedef unsigned long int uword;
  284. #else                    /* IntBits == 16 */
  285. typedef int word;
  286. typedef unsigned int uword;
  287. #endif                    /* IntBits == 16 */
  288.  
  289. #define WordSize sizeof(word)
  290.  
  291. #ifndef ByteBits
  292. #define ByteBits 8
  293. #endif                    /* ByteBits */
  294.  
  295. /*
  296.  * Define the size of the units in MemMon (allocation history) files.
  297.  */
  298. #ifndef MMUnits
  299. #define MMUnits WordSize
  300. #endif                    /* MMUnits */
  301.  
  302. /*
  303.  * Change the name of gcvt() if we're supplying our own version,
  304.  * to avoid complaints under VMS and others with shared libraries.
  305.  */
  306.  
  307. #ifdef IconGcvt
  308. #define gcvt icon_gcvt
  309. #endif                    /* IconGcvt */
  310.  
  311.  
  312. /*
  313.  *  The following definitions depend on whether or not the ANSI C standard
  314.  *  is supported.
  315.  */
  316.  
  317. #ifdef Standard
  318. #undef StandardC
  319. #undef StandardPP
  320. #define StandardC
  321. #define StandardPP
  322. #endif                    /* Standard */
  323.  
  324. #ifdef StandardPP
  325. #define Cat(x,y) x##y
  326. #define Lit(x) #x
  327. #else                    /* StandardPP */
  328. #define Ident(x) x
  329. #define Cat(x,y) Ident(x)y
  330. #define Lit(x) "x"
  331. #endif                    /* StandardPP */
  332.  
  333. #ifdef StandardC
  334. #undef Prototypes
  335. #define Prototypes
  336. #ifndef PointerDef
  337. typedef void *pointer;
  338. #endif                    /* PointerDef */
  339. #undef VoidType
  340. #define VoidType
  341. #define Bell '\a'
  342. #else                    /* StandardC */
  343. #ifndef PointerDef
  344. typedef char *pointer;
  345. #endif                    /* PointerDef */
  346. #if EBCDIC == 0
  347. #define Bell '\007'
  348. #else                    /* EBCDIC == 0 */
  349. #define Bell '\x2F'
  350. #endif                    /* EBCDIC == 0 */
  351. #endif                    /* StandardC */
  352.  
  353. /*
  354.  * Provide definition to use void if it's supported (mainly avoids error
  355.  *  messages with some C compilers.  Note: typedef does not work, so care
  356.  *  is needed not to use compound declarations.
  357.  */
  358.  
  359. #ifdef VoidType
  360. #define novalue void
  361. #define noargs void
  362. #else                    /* VoidType */
  363. #define novalue int
  364. #define noargs
  365. #endif                    /* VoidType */
  366.  
  367. /*
  368.  * Customize output if not pre-defined.
  369.  */
  370.  
  371. #ifndef TraceOut
  372. #define TraceOut(s) fprintf(stderr,s)
  373. #endif                    /* TraceOut */
  374.  
  375. #if EBCDIC == 0
  376. #define BackSlash "\\"
  377. #else                    /* EBCDIC == 0 */
  378. #define BackSlash "\xe0"
  379. #endif                    /* EBCDIC == 0 */
  380.  
  381. #if UNIX
  382. #define WriteBinary "w"
  383. #define ReadBinary "r"
  384. #define WriteText "w"
  385. #define ReadText "r"
  386. #endif                    /* UNIX */
  387.  
  388. #ifndef WriteBinary
  389. #define WriteBinary "wb"
  390. #endif                    /* WriteBinary */
  391.  
  392. #ifndef ReadBinary
  393. #define ReadBinary "rb"
  394. #endif                    /* ReadBinary */
  395.  
  396. #ifndef WriteText
  397. #define WriteText "w"
  398. #endif                    /* WriteText */
  399.  
  400. #ifndef ReadText
  401. #define ReadText "r"
  402. #endif                    /* ReadText */
  403.  
  404. /*
  405.  * Typedefs to make some things easier.
  406.  */
  407.  
  408. typedef int (*fptr)();
  409. typedef struct descrip *dptr;
  410.  
  411. /*
  412.  * "hidden" is used to declare static functions;  "hidden" normally == "static",
  413.  *  except with compilers that can't handle "static" in prototypes.
  414.  */
  415.  
  416. #ifndef hidden
  417. #define hidden static
  418. #endif                    /* hidden */
  419.  
  420. /*
  421.  * The "Params" macro allows a single declaration to be used with both old- and
  422.  *  new-style compilers.
  423.  */
  424.  
  425. #ifdef Prototypes
  426. #define Params(a) a
  427. #else                    /* Prototypes */
  428. #define Params(a) ()
  429. #endif                    /* Prototypes */
  430.  
  431. /*
  432.  * cal_time holds a calendar time.
  433.  */
  434. struct cal_time {
  435.    int year;        /* yyyy */
  436.    int month_no;    /* month number: 1-12 */
  437.    char *month_nm;    /* month name: "January", "February", ... */
  438.    int mday;        /* day of the month */
  439.    char *wday;        /* "Sunday", "Monday", ... */
  440.    int hour;        /* hour by 24 hr clock */
  441.    int minute;
  442.    int second;
  443.    };
  444.  
  445. /*
  446.  * Function prototypes.
  447.  */
  448.  
  449. #include "::h:proto.h"
  450.  
  451. /*
  452.  * More definitions depending on whether or not ints and pointers
  453.  * are the same size.  These must follow the include of proto.h to
  454.  * avoid redefinition problems with some compilers.
  455.  */
  456.  
  457. #if IntBits == 16
  458. #define sbrk lsbrk
  459. #define qsort llqsort
  460. #define strlen lstrlen
  461. #endif                    /* WordBits != IntBits */
  462.  
  463. /*
  464.  * The following code is operating-system dependent [@config.01].
  465.  *  Any configuration stuff that has to be done at this point.
  466.  */
  467.  
  468. #if PORT
  469.    /* Probably nothing is needed. */
  470. Deliberate Syntax Error
  471. #endif                    /* PORT */
  472.  
  473. #if AMIGA || ATARI_ST || MACINTOSH || MSDOS || MVS || VM || VMS
  474.    /* Nothing is needed */
  475. #endif                    /* AMIGA || MACINTOSH ...*/
  476.  
  477. #if HIGHC_386
  478. /*
  479.  * MetaWare's HighC 386 macro putc doesn't handle putc('\n') correctly -
  480.  * sometimes a CR is not written out before the LF.  So, redefine
  481.  * macro putc to actually issue an fputc.
  482.  */
  483. #undef putc
  484. #define putc(c,f) fputc(c,f)
  485. #endif                    /* HIGHC_386 */
  486.  
  487. #if MACINTOSH
  488. #if LSC
  489. /*
  490.  * LightSpeed C requires that #define tokens appear after prototypes
  491.  */
  492. #define index strchr
  493. #define malloc mlalloc
  494. #define rindex strrchr
  495. #define unlink remove
  496. #endif                    /* LSC */
  497. #endif                    /* MACINTOSH */
  498.  
  499. #if UNIX || (MACINTOSH && MPW)
  500.  
  501. #undef WriteBinary
  502. #define WriteBinary "w"
  503.  
  504. #undef ReadBinary
  505. #define ReadBinary "r"
  506.  
  507. #ifndef NoHardWiredPaths
  508. #define HardWiredPaths
  509. #endif                    /* NoHardWiredPaths */
  510.  
  511. #ifndef NoHeader
  512. #undef Header
  513. #define Header
  514. #endif                    /* NoHeader */
  515.  
  516. #endif                    /* UNIX || (MACINTOSH && MPW) */
  517.  
  518. /*
  519.  * End of operating-system specific code.
  520.  */
  521.  
  522.  
  523. #ifndef DiffPtrs
  524. #define DiffPtrs(p1,p2) (word)((p1)-(p2))
  525. #endif                    /* Diffptrs */
  526.  
  527. #ifndef AllocReg
  528. #define AllocReg(n) malloc((msize)n)
  529. #endif                    /* AllocReg */
  530.